package com.zg.common.core.dao.autoform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zg.common.core.dao.autoform.DiyColumn;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author Zxb
 */
@Mapper
public interface DiyColumnMapper extends BaseMapper<DiyColumn> {

    @Select("SELECT tc.column_name,tc.data_type,tc.data_length,tc.data_precision,tc.data_scale,tc.nullable,tc.column_id,cc.comments" +
            " FROM  user_tab_columns tc LEFT JOIN  user_col_comments cc  ON tc.table_name = cc.table_name    AND tc.column_name = cc.column_name" +
            " WHERE  tc.table_name = #{tableName}" +
            " ORDER BY tc.column_id")
    List<Map<String,Object>> listColumn(@Param("tableName") String tableName);
}
